﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System.Windows.Forms
{
    /// <summary>
    /// 表示控件基类
    /// </summary>
    /// <creator>marc</creator>
    public class ControlBase : UserControl
    {
        /// <inheritdoc cref="ControlBase"/>
        protected ControlBase()
        {
            Initialize();

            DoubleBuffered = true;
        }

        /// <summary>
        /// 在构造函数中初始化
        /// </summary>
        protected virtual void Initialize()
        {

        }

        /// <summary>
        /// 提示
        /// </summary>
        /// <param name="text">消息内容</param>
        protected DialogResult ShowInformation(string text)
        {
            return MessageBox.Show(text, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        /// <summary>
        /// 警告
        /// </summary>
        /// <param name="text">消息内容</param>
        protected DialogResult ShowWarning(string text)
        {
            return MessageBox.Show(text, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
        /// <summary>
        /// 错误
        /// </summary>
        /// <param name="text">消息内容</param>
        protected DialogResult ShowError(string text)
        {
            return MessageBox.Show(text, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
